{use master_page('front/v_home_master')}

{block body}
<?
$where = $this->Request();
// $where['page_size'] = 10;
$guest_books = $this->article_manager->get_list($where); 
$record_count = $this->article_manager->query_result->record_count;
?>
<script>
$(document).ready(function(){
	if($.browser.msie)
	// if(1==1)   
	{
		var slider = $("#gallery").bxSlider({
			pager: true,
			controls: false,
			buildPager: function(slideIndex){
				var img_src = $('#gallery li:eq(' + (slideIndex+1) + ') img').attr('src');
				return '<a href=""><img src="' + img_src + '" style="border:1px solid #bfbfbf;width:26px;height:26px;margin:3px" /></a>';  
			}
		}); 
		var bx_window = $("#gallery").parent();
		bx_window.css('margin','0px');
		//bx_wondow.css('border','10px solid black') ; 
		bx_window.css('width','1002px');
		var bw_pos = bx_window.offset();
		var btn_left = $('<span>&lt</span>');
		btn_left.css('font-size','24px');
		btn_left.css('cursor','pointer');
		btn_left.css('position','absolute'); 
		btn_left.css('left',bx_window.width()/6-10);
		btn_left.css('top',bx_window.height()/2);
		btn_left.click(function(){
			slider.goToPreviousSlide();
			return false;
		});
		var btn_right = $('<span>&gt</span>');
		btn_right.css('font-size','24px');
		btn_right.css('cursor','pointer');
		btn_right.css('position','absolute'); 
		btn_right.css('left',bx_window.width()/6*5);
		btn_right.css('top',bx_window.height()/2);
	
		btn_right.click(function(){
			slider.goToNextSlide();
			return false;
		});
		 
		bx_window.append(btn_left); 
		bx_window.append(btn_right);
		bx_window.click(function(ob){
			var x = ob.offsetX;
			if(x>1 && x < 450 )
			{
				btn_left.click();
			}
			if(x>450 && x<900)
			{
				btn_right.click() ; 
			}
		}); 
	}
	else
	{
		Galleria.loadTheme('../../scripts/jquery_plugins/galleria/themes/classic/galleria.classic.min.js');
		$("#gallery").galleria({
			width: 1003,
			height: 500,
			// transition: "none",
		    // imageCrop: true,
		    thumbCrop: "height"
		    //easing: "galleriaOut"
		});

		//$("#gallery .galleria-container").css('background','#efefef');
		$(".galleria-image").css('display','none');
		
	}
}); 
</script> 
<div id="content" style="width: 1002px;background-color:#000;padding:10px 0px">
	<ul id="gallery" style="margin:0px;padding:0px;">
	<?foreach ( $guest_books as $article):?>
		<?if(sizeof($article->fetch_images())==0):?>	
		<!--li><img src="images/noimage_1.jpg" boeder="0px"></img></li-->
		<?else:?>	
		<li><img src="<?=$article->fetch_image(0)?>" alt="{article->title}" border="0px"></img></li>
		<?endif?>	
	<?endforeach;?> 
	</ul>
</div>
 
{end} 